package com.wing.productionPlan.enumeration;

public enum OperationEnumType {

    ADD("001", "后台添加"),
    IMPORT("002", "系统导入"),
    PUSH("003", "系统推送");

    private final String code;
    private final String data;

    // 构造函数
    OperationEnumType(String code, String data) {
        this.code = code;
        this.data = data;
    }

    // Getter 方法
    public String getCode() {
        return code;
    }

    public String getData() {
        return data;
    }

    // 通过code查找OperationType的方法
    public static OperationEnumType getByCode(String code) {
        for (OperationEnumType operation : values()) {
            if (operation.getCode().equals(code)) {
                return operation;
            }
        }
        throw new IllegalArgumentException("No matching operation for code: " + code);
    }

    // 可选：如果需要根据code获取data，可以提供此方法
    public static String getDataByCode(String code) {
        OperationEnumType operation = getByCode(code);
        return operation.getData();
    }


}
